package main

import (
	"google.golang.org/grpc"
	"gowork/studentGrpc/webMessage"
	"gowork/studentGrpc/webClient/util"
	"gowork/studentGrpc/webClient/controller"
	"github.com/kataras/iris/v12"
	"github.com/kataras/iris/v12/mvc"
)

func main() {

	//1、Dail连接
	conn, err := grpc.Dial("localhost:9364", 
	grpc.WithInsecure(),
	// grpc.RoundRobin(grpclb.NewConsulResolver(
    //     "127.0.0.1:8500", "grpc.health.v1.add",
    // 	))
	)

	util.Cli = webMessage.NewStudentServiceClient(conn)

	app := iris.New()
	mvc.New(app).Handle(new(controller.StudentGrpcController))
	app.Run(iris.Addr(":5476"))

	if err != nil {
		panic(err.Error())
	}
	defer conn.Close()
}